CREATE TABLE [dbo].[wap_tracking]
(
[nu_operacion] [dbo].[_autonumerico] NOT NULL IDENTITY(1, 1),
[fe_operacion] [dbo].[_fechahora] NOT NULL,
[cd_operador] [dbo].[_nombre] NOT NULL,
[nm_programa] [dbo].[_codigo_largo] NOT NULL,
[nm_tabla] [dbo].[_nombre] NULL,
[tp_operacion] [dbo].[_codigo_largo] NOT NULL,
[nm_terminal] [dbo].[_nombre] NOT NULL,
[de_operacion] [dbo].[_memo] NOT NULL,
[de_clave] [dbo].[_nombre] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[wap_tracking] ADD CONSTRAINT [PK_wap_tracking] PRIMARY KEY NONCLUSTERED  ([nu_operacion]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [FK_cd_operador] ON [dbo].[wap_tracking] ([cd_operador]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [FK_nm_programa] ON [dbo].[wap_tracking] ([nm_programa]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [FK_nm_terminal] ON [dbo].[wap_tracking] ([nm_terminal]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[wap_tracking] ADD CONSTRAINT [FK_wap_tracking_wad_operadores] FOREIGN KEY ([cd_operador]) REFERENCES [dbo].[wad_operadores] ([cd_operador]) ON DELETE CASCADE ON UPDATE CASCADE
GO
ALTER TABLE [dbo].[wap_tracking] ADD CONSTRAINT [FK_wap_tracking_wad_programas] FOREIGN KEY ([nm_programa]) REFERENCES [dbo].[wad_programas] ([nm_programa]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[wap_tracking] ADD CONSTRAINT [FK_wap_tracking_wad_tablas] FOREIGN KEY ([nm_tabla]) REFERENCES [dbo].[wad_tablas] ([nm_tabla]) ON DELETE CASCADE ON UPDATE CASCADE
GO
ALTER TABLE [dbo].[wap_tracking] ADD CONSTRAINT [FK_wap_tracking_wad_pref_terminal] FOREIGN KEY ([nm_terminal]) REFERENCES [dbo].[wad_terminales] ([nm_terminal]) ON DELETE CASCADE
GO
EXEC sp_bindefault N'[dbo].[date]', N'[dbo].[wap_tracking].[fe_operacion]'
GO
